package com.hejing.初识泛型;

/**
 * ClassName: Employee
 * Package: com.hejing.初识泛型
 * Description:
 *  定义一个Employee类
 *  该类包含: private成员变量name, age, birthday。其中birthday为MyDate类的对象；
 *  为每一个属性定义getter、setter方法
 *  重写toString方法输出 name、age、birthday
 *
 * @Author: HeJing
 * @Create: 2023-05-21 19:09
 * @Version: 1.0
 */
public class Employee implements Comparable<Employee>{

    private String name;
    private int age;
    private MyDate birthday;

    public Employee() {

    }

    public Employee(String name, int age, MyDate birthday) {
        this.name = name;
        this.age = age;
        this.birthday = birthday;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public MyDate getBirthday() {
        return birthday;
    }

    public void setBirthday(MyDate birthday) {
        this.birthday = birthday;
    }

    // toString

    @Override
    public String toString() {
        return "Employee{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", birthday=" + birthday +
                '}';
    }


    // 按照 name从小到大排序
    @Override
    public int compareTo(Employee e) {

        return this.name.compareTo(e.name);

    }
}

























